package com.qili.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhaoyongke
 * @date 2020/11/4
 * @description
 */

public enum UploadType {
    CUSTOM(0),
    PERSON(1),
    NONE(2),
    ELAL(3),
    IMAGE(4),
    ArtImage(5),
    USER(6);


    private int _iType;
    private String _sFileName;
    private String _sFilePathId;
    private Integer ind;
    //注意 此处索引顺序必须和yml文件中placeholder索引对应
    private List<String> _yPlaceholder = new ArrayList<String>();

    public int getType() {
        return _iType;
    }

    public void setType(int type) {
        this._iType = type;
    }

    public String getFilePathId() {
        return _sFilePathId;
    }

    public void setFilePathId(String pathId) {
        this._sFilePathId = pathId;
    }

    public String getFileName() {
        return _sFileName;
    }

    public void setFileName(String FileName) {
        this._sFileName = FileName;
    }

    public List<String> getPlaceholder() {
        return _yPlaceholder;
    }

    public void setPlaceholder(List<String> Placeholder) {
        this._yPlaceholder = Placeholder;
    }

    public void appendPlaceHolder(String psHolder) {
        this._yPlaceholder.add(psHolder);
    }

    public void appendPlaceHolder(int piIdx, String psHolder) {
        this._yPlaceholder.set(piIdx, psHolder);
    }

    public Integer getInd() {
        return ind;
    }

    public void setInd(Integer ind) {
        this.ind = ind;
    }

    UploadType(int type) {
        this._iType = type;
    }

    UploadType(int type, String fileName, String filePathId) {
        this._iType = type;
        this._sFileName = fileName;
        this._sFilePathId = filePathId;
    }

    UploadType(int type, String fileName, String filePathId, ArrayList placeHolder) {
        this._iType = type;
        this._sFileName = fileName;
        this._sFilePathId = filePathId;
        this._yPlaceholder = placeHolder;
    }

    public static UploadType getEnumByType(int type) {
        for (UploadType bt : values()) {
            if (bt._iType == type) {
                return bt;
            }
        }
        return null;
    }
}
